package atguigu.com.login.exception;


import atguigu.com.login.VO.ResponseEnum;
import lombok.Data;

@Data
public class Guliexception extends RuntimeException{
    private Integer code;
    /*
    * 我们这个guliexception是继承自runtimeexception,而它又继承自exception,最上层是throwable
    * 只有在最上层的throwable有很多属性，比如detailmessage,这个属性会一直传下去
    * public RuntimeException(String message) {
        super(message);
    }
    * public Exception(String message) {
        super(message);
    }
    *  public Throwable(String message) {
        fillInStackTrace();
        detailMessage = message;
    }----------》public String getMessage() {
        return detailMessage;
    }
    * 父类的构造方法是不会被继承的，而最高级的父类的属性detailmessage是会被一直往下传的，最终会传到
    * guliexception中，然后通过不断调父类的构造方法来对其赋值
    * public String getMessage() {
        return detailMessage;
    }这个方法页会被子类继承下来
    *
    *
    * */
    public Guliexception(Integer code,String message){
        super(message);
        this.code=code;
    }
    public Guliexception(ResponseEnum responseEnum){
        super(responseEnum.getMessage());
        this.code=responseEnum.getCode();
    }
}
